feat(docker): show container MAC addresses#2621
Conversation
- Purpose: expose Docker endpoint MAC addresses in the advanced container list for router and macvlan configuration workflows. - Before: the Docker page showed container network names and IPs, but discarded MacAddress from inspect data. - Problem: users had to SSH into Unraid and run docker inspect manually to find MAC addresses. - Change: preserve MacAddress for each container network and render it in an advanced-only MAC Address column. - Implementation: carries MacAddress through DockerClient network metadata and displays aligned values in DockerContainers.php.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughBackend now collects per-network MAC addresses from Docker API responses; templates and rendering were updated to show MACs inline with network IPs and the table header and placeholder colspan were adjusted to account for the added column. Changes
Sequence Diagram(s)(omitted — changes are localized UI/data formatting and do not introduce multi-component sequential flows) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
🔧 PR Test Plugin AvailableA test plugin has been generated for this PR that includes the modified files. Version: 📥 Installation Instructions:Install via Unraid Web UI:
Alternative: Direct Download
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
emhttp/plugins/dynamix.docker.manager/include/DockerContainers.php (1)
352-352: Fix orphan row column span to match the 11-column table.Line 352 currently yields a 9-cell row (
1 + 7 + 1) in an 11-column table, which can misalign orphan rows in advanced view.Proposed alignment fix
- echo "</td><td colspan='7'>"._('Image ID').": $id<br>"; + echo "</td><td colspan='9'>"._('Image ID').": $id<br>";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@emhttp/plugins/dynamix.docker.manager/include/DockerContainers.php` at line 352, The orphan row uses "<td colspan='7'>" which creates a 9-cell row (1 + 7 + 1) in an 11-column table; update the colspan in DockerContainers.php (the echo that prints "Image ID: $id") from 7 to 9 so the row becomes 1 + 9 + 1 = 11 and aligns correctly with the table.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@emhttp/plugins/dynamix.docker.manager/include/DockerContainers.php`:
- Line 352: The orphan row uses "<td colspan='7'>" which creates a 9-cell row (1
+ 7 + 1) in an 11-column table; update the colspan in DockerContainers.php (the
echo that prints "Image ID: $id") from 7 to 9 so the row becomes 1 + 9 + 1 = 11
and aligns correctly with the table.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 4fa83fd4-cb23-47e3-bc78-51f8b13f11ea
📒 Files selected for processing (3)
emhttp/plugins/dynamix.docker.manager/DockerContainers.pageemhttp/plugins/dynamix.docker.manager/include/DockerClient.phpemhttp/plugins/dynamix.docker.manager/include/DockerContainers.php
- Purpose: keep the Docker container table compact while still exposing MAC addresses in advanced view. - Before: the PR added a separate advanced-only MAC Address column next to Container IP. - Problem: the extra column widened the Docker page table for data that belongs with each endpoint IP. - Change: render each network MAC address as an advanced-only line beneath the matching container IP. - Implementation: removes the MAC Address header and extra cell while preserving MacAddress data from DockerClient.
- Purpose: make the advanced Docker network value more compact and readable. - Before: MAC addresses appeared beneath the container IP as a stacked advanced-only line. - Problem: the requested presentation is a single Container IP / MAC value. - Change: updates the heading to include advanced-only / MAC text and renders MAC addresses inline after the container IP with a slash separator. - Implementation: keeps the MAC span advanced-only so basic view continues to show only the container IP.
- Purpose: match the requested advanced Docker cell presentation. - Before: the MAC address rendered inline after the container IP with a slash separator. - Problem: the desired layout is easier to scan as two lines without a MAC label. - Change: renders the container IP first and the raw MAC address on the next advanced-only line. - Implementation: keeps the MAC value inside the advanced span so basic view remains unchanged.
- Purpose: address PR feedback about matching MAC visibility to container IP visibility. - Before: stopped containers hid the IP address but could still carry a MAC address value into the advanced cell. - Problem: the MAC line should follow the same running-state behavior as the IP line. - Change: only renders a network MAC address when the container is running. - Implementation: applies the existing running check to the MacAddress display value.
Summary
Why
Users running containers on macvlan need the container MAC address for router and network configuration. Before this change, the UI did not expose that value, so users had to SSH into Unraid and run docker inspect manually.
Testing
Summary by CodeRabbit
New Features
Bug Fixes